<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<%@ include file="/common/meta.jsp"%>
	<title>汪星客 - 个人中心 - 我的收藏</title>
</head>
<body>
<div class="wrap">
	<div class="header_bg">
		<div class="header box">
            <%@ include file="/common/header.jsp"%>
        </div>
    </div>
    <div class="w">
    	<div class="path box">
            <jsp:include page="/common/frame/frame_path.jsp">
           		<jsp:param name="current" value="我的收藏"/>
           	</jsp:include>
        </div>
    </div>
    <div class="main">
    	<div class="list box">
        	<div class="pc_left">
            	<jsp:include page="/common/frame/frame_left.jsp">
            		<jsp:param name="checked" value="favorites"/>
            	</jsp:include>
            </div>
            <div class="pc_right">
                <dl id="framework_main_fav_list" class="pc_m">
                	
                </dl>
            </div>
            <div class="clear"></div>
		</div>
    </div>
    <div class="footer_bg">
    	<%@ include file="/common/footer.jsp"%>
    </div>
</div>
</body>
<script type="text/javascript">
function initList() {
	$.getJSON("${ctx}/fvt/list.do", function(rows) {
 		var $list = $("#framework_main_fav_list").html("");
 		$.each(rows, function(){
//  		<div class="collect bor_bot">
// 	        	<div class="collect_img"><img src="imgs/img.jpg" /></div>
// 	            <div class="collect_m">
// 	            	<h2>城市狗明星狗训练</h2>
// 	                <p class="m_top"><span class="colr">北京市 石景山区 金顶街</span><br /><span class="red">￥30</span>/晚</p>
// 	                <div class="fl"><p class="fl">已获得 <span class="red">7</span> 份评价</p><p class="fr"><a href="#">预约</a> <a href="#">咨询</a> <a href="#">从列表移除</a></p></div>
// 	            </div>
// 	        </div>
 			var $host = $("<div class='collect bor_bot'></div>");
 			$host.append("<div class='collect_img'><img width='100' height='100' src='${ctx}/tools/download.do?dir=HEAD&fileName=" + this.userPhotoPath + "'/></div>");
 			$host.find(".collect_img > img").error(function(){
 				$(this).attr("src", "${ctx}/images/user_no_head.jpg");
 			});
 			$hostInfo = $("<div class='collect_m'></div>")
				.append("<a href='${ctx}/show.jsp?id=" + this.id + "'><h2>" + this.hostName + "<h2></a>")
				.append("<p class='m_top'><span class='colr'>" + this.cityName + " " + this.distName + " " + this.hostArea + "</span><br /><span class='red'>￥" + this.serverVal + "</span>/晚</p>")
				.append("<div class='fl'><p class='fl'>已获得 <span class='red'>" + (this.assessNum==undefined?0:this.assessNum) + "</span> 份评价</p><p class='fr'><a href='javascript:tendog.win.order(\"" + this.id + "\");'>预约</a> <a href='javascript:deleteFavorites(" + this.fvtId + ")'>从列表移除</a></p></div>")
			$host.append($hostInfo);
 			$list.append($host);
 		});
 	});
}

function deleteFavorites(id) {
	$.getJSON("${ctx}/fvt/del.do?id=" + id, function(res){
		if(res.code==1) {
			msg.msg("删除成功!");
			initList();
		} else {
			msg.error(res.msg);
		}
	});
}
$(function(){
	initList();
});
</script>
</html>